package com.ruoyi.vip.service.impl;


import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.vip.domain.Vip;
import com.ruoyi.vip.mapper.VipMapper;
import com.ruoyi.vip.service.IVipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 会员信息Service业务层处理
 *
 * @author ruoyi
 * @date 2021-04-19
 */
@Service
public class VipServiceImpl implements IVipService
{
    @Autowired(required=false)
    private VipMapper vipMapper;

    /**
     * 查询会员
     *
     * @param vipId 会员ID
     * @return 会员
     */
    @Override
    public Vip selectVipById(Long vipId)
    {
        return vipMapper.selectVipById(vipId);
    }

    /**
     * 查询会员列表
     *
     * @param vip 会员
     * @return 会员
     */
    @Override
    public List<Vip> selectVipList(Vip vip)
    {
        return vipMapper.selectVipList(vip);
    }

    /**
     * 新增会员
     *
     * @param vip 会员
     * @return 结果
     */
    @Override
    public int insertVip(Vip vip)
    {
        vip.setCreateTime(DateUtils.getNowDate());
        return vipMapper.insertVip(vip);
    }

    /**
     * 修改会员
     *
     * @param vip 会员
     * @return 结果
     */
    @Override
    public int updateVip(Vip vip)
    {
        vip.setUpdateTime(DateUtils.getNowDate());
        return vipMapper.updateVip(vip);
    }

    /**
     * 批量删除会员
     *
     * @param vipIds 需要删除的会员ID
     * @return 结果
     */
    @Override
    public int deleteVipByIds(Long[] vipIds)
    {
        return vipMapper.deleteVipByIds(vipIds);
    }

    /**
     * 删除会员信息
     *
     * @param vipId 会员ID
     * @return 结果
     */
    @Override
    public int deleteVipById(Long vipId)
    {
        return vipMapper.deleteVipById(vipId);
    }
}
